#include <stdio.h>
#include <string.h>

void reverse(char*left,char *right)
{
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}
}

int main()
{
	char str[] = { "I like beijing." };
	int len = strlen(str);
	reverse(str,str+len-1);

	char* start = str;
	char* end = start;
	while (*end)
	{
		while (*end != ' '&&*end!='\0')
		{
			end++;
		}
		end--;
		reverse(start, end);
		end++;
		while (*end == ' ')
		{
			end++;
		}
		start = end;
	}
	printf("%s\n", str);
	return 0;
}